#下面是一个完整的示例，包括所有必要的类定义：
class Hero:
    def __init__(self, name, hp, *args):
        self.name = name
        self.hp = hp
        self.args = args

    def display(self):
        print(f"I am a generic hero. Name={self.name}, HP={self.hp}")


class APCHero(Hero):
    def __init__(self, name, hp, *args):
        super().__init__(name, hp, *args)
        print(f"APC Hero created: Name={name}, HP={hp}")
        if args:
            print(f"Additional attributes: {args}")

    def display(self):
        print(f"I am an APC hero. Name={self.name}, HP={self.hp}")
        if self.args:
            print(f"Additional attributes: {self.args}")


class ADCHero(Hero):
    def __init__(self, name, hp, *args):
        super().__init__(name, hp, *args)
        print(f"ADC Hero created: Name={name}, HP={hp}")
        if args:
            print(f"Additional attributes: {args}")

    def display(self):
        print(f"I am an ADC hero. Name={self.name}, HP={self.hp}")
        if self.args:
            print(f"Additional attributes: {self.args}")


class HeroFactory:
    @staticmethod
    def create_hero(hero_type, *args, **kwargs):
        name = kwargs.get('name')
        hp = kwargs.get('hp')

        if not name or not hp:
            raise ValueError("Name and HP are required")

        if hero_type == "apc":
            return APCHero(name, hp, *args)
        elif hero_type == "adc":
            return ADCHero(name, hp, *args)
        else:
            return Hero(name, hp, *args)


# 示例用法
if __name__ == "__main__":
    # 创建不同类型英雄的实例
    apc_hero = HeroFactory.create_hero("apc", 30,40,name="Alice", hp=100, attack=50, magic=80)
    adc_hero = HeroFactory.create_hero("adc", name="Bob", hp=80, attack=60, speed=70)
    generic_hero = HeroFactory.create_hero("other", name="Charlie", hp=70, defense=70, agility=60)

    # 显示英雄信息
    apc_hero.display()
    adc_hero.display()
    generic_hero.display()